<form class="layui-form seller-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline" style="padding-left: 5px;">
            <input type="text" name="username" lay-verify="title" placeholder="Input username" autocomplete="off"
                   class="layui-input" value="" style="width: 200px;">
        </div>
        <div class="layui-inline" style="padding-left: 5px;">
            <input type="text" name="amount" lay-verify="title" placeholder="Input amount" autocomplete="off"
                   class="layui-input" value="" style="width: 200px;">
        </div>
        <div class="layui-inline">
            <select name="is_ok" >
                <option value="">处理状态</option>
                <option value="0">未处理</option>
                <option value="1">已处理</option>
                <option value="2">处理失败</option>
            </select>
        </div>
        <div class="layui-inline">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*"><i class="iconfont icon-chaxun"></i>Search</button>
            </div>
        </div>
    </div>
</form>
<div class="table-body">
    <table id="balanceTable" lay-filter="balanceTable"></table>
</div>
<script>
    layui.use(['form', 'laydate', 'table',], function () {
        var laydate = layui.laydate,
            form = layui.form,
            table = layui.table; //表格
        //时间插件
        laydate.render({
            elem: '#datetime',
            range: '_',
            format: 'yyyy-MM-dd'
        });
        table.render({
            elem: '#balanceTable',
            height: 'full-99',
            cellMinWidth: '80',
            totalRow: true,
            method: 'post',
            url: "{:url('usdtReturn')}",
            id: 'balanceTable',
            cols: [[
                { type: 'numbers'},
                { field: 'username',  align: 'left', title: '申请用户',width:180},
                { field: 'out_trade_no',  align: 'left', title: 'old订单号',width:210},
                { field: 'trade_no_new',  align: 'left', title: 'new订单号',width:210},
                { field: 'error_time',  align: 'left', title: '实际付款时间',width:180},
                { field: 'amount', title: '实际付款金额', align:"right",
                    style:'color:#FF5722;font-weight:bold', totalRow: true,width:150},
                { align: 'left', title: '处理状态',width:120,
                    templet: function (d) {
                        const is_ok=d.is_ok;
                        var   color = "#6c757d";
                        var   show_name = '等待中';
                        var   html = ''
                        if(is_ok == 1){
                            color = 'green';
                            show_name = '已处理';
                        }else if(is_ok == 2)
                        {
                            color = 'red';
                            show_name = '处理失败';
                        }else{
                            var html = '<a class="layui-btn layui-btn-xs" href="' + "{:url('usdtAction')}?id=" + d.id + '">详情</a>&nbsp;&nbsp;&nbsp;';
                        }
                        html+='<span style="color: ' + color + '">' + show_name + '</span>';
                        return html;
                    }
                },
                { field: 'trx_hash',  align: 'left', title: '交易hash',width:200},
                { field: 'ctime',  align: 'left', title: '创建时间',width:180},
                { field: 'utime',  align: 'left', title: '结束时间',width:180},
                { field: 'remark',  align: 'left', title: '描述',width:250},
                { field: 'id',  align: 'left', title: 'id',width:100},
            ]],
            page: true,
            limit: 50,
            limits: [50,1000, 10000],
        });
        form.on('submit(*)', function (data) {
            layui.table.reload('balanceTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>